package com.changgou.search.listener;

import com.changgou.search.config.RabbitmqConfig;
import com.changgou.search.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/*定义的rabbitmq监听类,根据监听的spuId查询sku列表写入es*/
@Component
public class GoodsUpListener {

    @Autowired
    private ESManagerService esManagerService;

    @RabbitListener(queues = RabbitmqConfig.SEARCH_ADD_QUEUE)
    public void receiveMessage(String spuId){
        System.out.println("接收到的消息"+spuId);
        esManagerService.importDataToESByspuId(spuId);
    }



}
